<?php namespace Summer\Box\Models;

use Model;
use Config;
use RainLab\User\Models\User as UserModel;
use Winter\Storm\Support\Collection;

/**
 * Model
 */
class BoxOrderModel extends Model
{
    use \Winter\Storm\Database\Traits\Validation;
    

    /**
     * @var string The database table used by the model.
     */
    public $table = 'summer_box_orders';

    /**
     * @var array Validation rules
     */
    public $rules = [
    ];
    public $belongsTo = [
        'item' => ['Summer\Box\Models\BoxItemModel', 'key' => 'item_id','otherKey'=>'id'],
        'selluser' => ['RainLab\User\Models\User', 'key' => 'sell_uid','otherKey'=>'id'],
        'buyuser' => ['RainLab\User\Models\User', 'key' => 'buy_uid','otherKey'=>'id'],
    ];
    public $attachOne = [
        'pay_cover' => 'System\Models\File'
    ];
    public function getStatusSlugOptions()
    {
        $status_slug=Config::get('summer.box::order_status_slug');
        $collection = new Collection($status_slug);
        return $collection->pluck('title','slug')->toArray();
    }

}
